﻿@using ClinicaMVC3.Controllers
@functions{

    static String returnThemeFolder(object Session)
    {
        if (Session == null)
        {
            return "ui-lightness";
        }
        else
        {
            return Session.ToString();
        }

    }

}
<!DOCTYPE html>
<script src="../../App_Themes/Scripts/jquery-1.7.1.js" type="text/javascript"></script>
<script src="../../App_Themes/Scripts/jquery-ui-1.8.18.js" type="text/javascript"></script>
<script src="../../App_Themes/Scripts/jquery-ui-1.8.18.js" type="text/javascript"></script>
<script src="../../App_Themes/Scripts/DataTables-1.9.0/media/js/jquery.dataTables.js"
    type="text/javascript"></script>
<script src="../../App_Themes/Scripts/DataTables-1.9.0/extras/TableTools/media/js/TableTools.js"
    type="text/javascript"></script>
<script src="../../App_Themes/Scripts/DataTables-1.9.0/extras/TableTools/media/js/ZeroClipboard.js"
    type="text/javascript"></script>
<script src="../../App_Themes/Scripts/jquery.validate.js" type="text/javascript"></script>
<script src="../../App_Themes/Scripts/jquery.validate.unobtrusive.js" type="text/javascript"></script>
<script src="../../App_Themes/Scripts/jquery.ui.datepicker-pt-BR.js" type="text/javascript"></script>
<script src="../../App_Themes/Scripts/jquery.effects.clip.js" type="text/javascript"></script>
<script src="../../App_Themes/Scripts/json2.js" type="text/javascript"></script>
<script src="../../App_Themes/Scripts/MicrosoftAjax.js" type="text/javascript"></script>
<script src="../../App_Themes/Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script>
<script src="../../App_Themes/Scripts/MicrosoftMvcValidation.js" type="text/javascript"></script>
<link href="../../App_Themes/Content/DataTables-1.9.0/extras/TableTools/media/css/TableTools_JUI.css" rel="stylesheet" type="text/css" />
<link href="../../App_Themes/Content/DataTables-1.9.0/media/css/jquery.dataTables_themeroller.css" rel="stylesheet" type="text/css" />
<link href="../../App_Themes/Content/DataTables-1.9.0/media/css/demo_table_jui.css"
    rel="stylesheet" type="text/css" />
<link href=@MvcHtmlString.Create("../../App_Themes/Themes/" + returnThemeFolder(Session["ThemeSelected"]) + "/jquery-ui.css") rel="stylesheet" type="text/css" />
<link href="../../App_Themes/Site.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
    var oTable;
    $(document).ready(
        function () {
            $.datepicker.setDefaults($.datepicker.regional["pt-BR"]);
            $(".datepicker").datepicker(
            {
                autoSize: true,
                changeMonth: true,
                changeYear: true
            }); ;


            $("fieldset").addClass("ui-widget ui-widget-content ui-corner-left ui-corner-right");
            $("input").addClass("ui-widget ui-corner-left ui-corner-right");
            $("textarea").addClass("ui-widget ui-corner-left ui-corner-right");
            $("select").addClass("ui-widget ui-corner-left ui-corner-right");
            $("h2").addClass("ui-widget-header ui-corner-all");
            $("h3").addClass("ui-widget-header ui-corner-all");
            $("legend").addClass("ui-widget-header ui-corner-all");
            $("legend").attr("style", "font-size: 15px !important;font-weight: normal; padding:5px 5px 5px 5px");
            $("#footercrud").addClass("ui-widget-header ui-corner-all");
            $("#footercrud").attr("style", "padding: 10px 10px 10px 10px");
            $("input:submit, input:button, a, button").attr("style", "vertical-align: middle;");
            $("input:submit, input:button, a, button").button();
            
            $(".tbl tbody tr").click(function (e) {
                if ($(this).hasClass('row_selected')) {
                    $(this).removeClass('row_selected');
                }
                else {
                    oTable.$('tr.row_selected').removeClass('row_selected');
                    $(this).addClass('row_selected');
                }
            });

            oTable = $('.tbl').dataTable(
                {
                    "bJQueryUI": true,
                    "asStripeClasses": ["even"],
                    "oTableTools":
                    {                     
                        "aButtons": [],
                        "sRowSelect": "single"
                    },
                    "oLanguage":
                    {
                        "sLengthMenu": "Mostrar _MENU_ registros por página.",
                        "sZeroRecords": " ",
                        "sInfo": "Mostrando _START_ até _END_ de _TOTAL_ registros",
                        "sInfoEmpty": "Mostrando 0 até 0 de 0 registros",
                        "sInfoFiltered": " ",
                        "sSearch": "Buscar:"
                    },
                    "bLengthChange": false,
                    "bAutoWidth": false,
                    "bSort": true,
                    "bInfo": true,
                    "bFilter": true,
                    "sPaginationType": "two_button"

                }
            );

        }
    );
  
</script>
<html>
<head>
    <title>@ViewBag.Title</title>
</head>
<body>
    <div class="page ui-tabs ui-corner-all">
        <div style="vertical-align: middle; padding: 0px 40px 40px 40px; font-size: 12px">
            <div id="themechoice">
                @{
                    TempData["CurrentController"] = ViewContext.Controller.ValueProvider.GetValue("controller").RawValue;
                    TempData["CurrentAction"] = ViewContext.Controller.ValueProvider.GetValue("action").RawValue;
                    TempData["CurrentId"] = (ViewContext.Controller.ValueProvider.GetValue("id") == null) ? 0 : ViewContext.Controller.ValueProvider.GetValue("id").RawValue;
                }
                @{
                    if (ViewContext.Controller.ValueProvider.GetValue("controller").RawValue != null)
                    {
                        if (ViewContext.Controller.ValueProvider.GetValue("controller").RawValue.ToString() != "Account")
                        {
                    @Html.Partial("ThemeChoice/Create")
                        }
                    }
                }
            </div>
            <div id="logindisplay">
                @Html.Partial("_LogOnPartial")
            </div>
        </div>
        <div id="header" class="ui-widget-header ui-corner-top">
            <div id="title">
                <h1>
                    Clinica da Saúde</h1>
            </div>
            <div id="menucontainer ui-corner-top">
                <ul id="menu" class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-bottom">
                    @if (User.IsInRole(FuncionarioController.funcao.Secretaria.ToString()) || User.IsInRole(FuncionarioController.funcao.Medico.ToString()))
                    {
                        <li class="ui-corner-top">@Html.ActionLink("Consulta", "Index", "Consulta").If(User.IsInRole(FuncionarioController.funcao.Secretaria.ToString()) || User.IsInRole(FuncionarioController.funcao.Medico.ToString()))</li>
                    }
                    @if (User.IsInRole(FuncionarioController.funcao.Administrador.ToString()))
                    {
                        <li class="ui-corner-top">@Html.ActionLink("Plano de Saude", "Index", "PlanoSaude").If(User.IsInRole(FuncionarioController.funcao.Administrador.ToString()))</li>
                    }
                    @if (User.IsInRole(FuncionarioController.funcao.Secretaria.ToString()))
                    {  
                        <li class="ui-corner-top">@Html.ActionLink("Paciente", "Index", "Paciente").If(User.IsInRole(FuncionarioController.funcao.Secretaria.ToString()))</li>
                    }
                    @if (User.IsInRole(FuncionarioController.funcao.Administrador.ToString()))
                    {  
                        <li class="ui-corner-top">@Html.ActionLink("Funcionário", "Index", "Funcionario").If(User.IsInRole(FuncionarioController.funcao.Administrador.ToString()))</li>
                    }
                </ul>
            </div>
        </div>
        <div id="main" class="ui-widget-content ui-widget ui-corner-bottom">
            @RenderBody()
        </div>
</body>
</html>
